﻿<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@page import="java.util.Map"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
<!--
.IMG{
	vertical-align : middle;
}
-->
</style>
<%
int ViewPageNumber=5;

Map PageInfo = (Map)request.getAttribute("PageInfo");
	int Page = 0;
	int PageSize = 0;
	int TotalPage = 0;
	try{
	Page = Integer.valueOf((String)PageInfo.get("Page"));
	PageSize = Integer.valueOf((String)PageInfo.get("PageSize"));
	TotalPage = Integer.valueOf((String)PageInfo.get("TotalPage"));
} catch(Exception e){

}
		

		int StartPage=((Page-1)/ViewPageNumber)*ViewPageNumber+1;
		int EndPage=StartPage+ViewPageNumber-1;
		if (EndPage>TotalPage){EndPage=TotalPage;}

		if (StartPage>ViewPageNumber)
		{
			int Pre=StartPage-ViewPageNumber;
			out.print("<a href='javascript:SetPage("+Pre+")'><<</a>&nbsp;");
		}
		for (int IA=StartPage;IA<EndPage+1;IA++)
		{
			if (IA==Page)
			{out.print("<font color='#FF0000'>"+IA+"</font>&nbsp;");}
			else
			{out.print("<a href='javascript:SetPage("+IA+")'>"+IA+"</a>&nbsp;");}
		}
		if (EndPage<TotalPage)
		{
			int Next=EndPage+1;
			out.print("<a href=\"javascript:SetPage("+Next+")\">>></a>&nbsp;");
		}
%>
第 <strong><%=Page%></strong> 頁
/
總共 <strong><%=TotalPage%></strong> 頁
跳至&nbsp;<input name="Page" id="Page" type="text" size="3" onchange="CheckPage()" maxlength="5">&nbsp;頁
&nbsp;&nbsp;<input id="gogo" type="image" src="images/go.gif" name="gogo" name="Submit" title="送出" class="IMG"/>

<script language="javascript">
function SetPage(page)
{
	document.getElementById('Page').value=page;
	document.getElementById('gogo').click();
}
function CheckPage()
{
	if (document.getElementById('Page').value<1)
	{document.getElementById('Page').value=1}
	else if (document.getElementById('Page').value><%=TotalPage%>)
	{document.getElementById('Page').value=<%=TotalPage%>}
}
</script>